package com.koron.css2.newProjectCenter.mapper;


import com.koron.css2.newProjectCenter.bean.EnterOrOutMaterialBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: 苏小龙
 * @CreateTime: 2024-12-04
 * @Description: 材料入库
 * @Version: 1.0
 */
public interface EnterOrOutMaterialMapper {
    void insert(EnterOrOutMaterialBean bean);

    @Update("update pub_up_material_enter_out set is_deleted = true where doc_id = #{docId}")
    void deleteByDocId(@Param("docId") String docId);

    @Select("select material_id, material_num, comments from pub_up_material_enter_out where doc_id = #{docId} and is_deleted = false")
    List<EnterOrOutMaterialBean> getMaterialListByDocId(@Param("docId") String docId);

    @Select("select count(0) > 0 from pub_up_material_enter_out where material_id = #{id} and is_deleted = false")
    boolean materialIsExistByMaterialId(@Param("id") String id);
}
